import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/HomePage.vue')
  },
  {
    path: '/product',
    name: 'product-manage',
    component: () => import('../views/product/ProductManagePage.vue')
  },
  {
    path: '/package-method',
    name: 'package-method',
    component: () => import('../views/package/PackageMethodPage.vue')
  },
  // 原 /bom/entries 页面去除，做兼容重定向到简版实现
  { path: '/bom/entries', redirect: '/bom-simple/entries' },
  {
    path: '/bom-simple/entries',
    name: 'bom-simple-entries',
    component: () => import('../views/bomSimple/BomSimpleEntryPage.vue')
  },
  {
    path: '/sku/product-details',
    name: 'sku-product-details',
    component: () => import('../views/sku/SkuProductDetailPage.vue')
  },
  {
    path: '/quote-poster/:code',
    name: 'quote-poster',
    // 直接以页面形式展示报价海报（不再使用对话框）
    component: () => import('../views/sku/QuotePosterPage.vue'),
    props: true,
    meta: { standalonePoster: true }
  },
  { path: '/:pathMatch(.*)*', redirect: '/' }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;
